//
//  XCTitleButton.swift
//  小陈微博Swift用纯代码创建
//
//  Created by 小陈 on 16/3/1.
//  Copyright © 2016年 小陈. All rights reserved.
//

import UIKit

class XCTitleButton: UIButton {
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    init(title: String){
     super.init(frame: CGRectZero)
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        
        self.sizeToFit()
        
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        // 图片和标题互换位置
        titleLabel?.frame.origin.x = 0
        imageView?.frame.origin.x = (titleLabel?.frame.size.width)! + 3
        
    }
    
  
}


  